Release 10.1A: OpenEdge Development:
Progress 4GL Handbook
Defining a browse
This section describes some of the major functionality and style choices available when you define a browse, and the issues involved with those choices.
You can browse records by defining a browse for the query and opening the query. If you do not specifically enable the browse columns, the result is a read-only browse. Once the user finds and selects a record, your application can use the selected record, which the associated query puts in one or more associated buffers. This is the general syntax for a browse definition:
As with all objects you define, you first give the browse a name. Next, you associate it with a query that you have previously defined. You can later associate the browse with a different query at run time by setting its
QUERYattribute, but the query it’s defined for is the source of initial information about the buffers and fields you use to define columns in the browse.Once again,
NO-LOCKis the only reasonable locking option even for a browse on a database table and the only possible one for a browse on a temp-table, since temp-table don’t support record locking. It’s also the default, so you can leave out theNO-LOCKkeyword altogether.The
DISPLAYphrase tells Progress which fields from the buffers in the query to display as columns in the browse. You can specify either an explicit space-delimitedcolumn-listor a list of one or more record buffers from the query. In the latter case, you can use theEXCEPTphrase to remove one or more fields from eachrecordwhen it is displayed. The default is not to display any fields at all, so you must always include aDISPLAYphrase in your browse definition unless you want to define all the columns at run time, as you will learn to do in Chapter 20, " Creating and Using Dynamic Temp-tables and Browses."If you just specify the
DISPLAYlist, the browse is read-only. None of its cells are enabled for input. Thebrowse-enable-phraselets you enable one or more cells for input:
Each column in the
ENABLEphrase must be a column in theDISPLAYlist. If you want to enable all or almost all the columns, you can use theALLkeyword optionally followed by anEXCEPTlist.There are many options you can specify in the
browse-options-phraseto customize the appearance and behavior of your browse. The phrase begins with theWITHkeyword. Here are some of the more important options:
rows DOWN[WIDTHwidth] — You can specify how many rows to display in the viewport of the browse and, optionally, the width of the browse in characters. If the result of the query contains more rows than can be displayed at once, then the browse has a vertical scrollbar to let the user see them. If you use theDOWNphrase but don’t specify aWIDTH, Progress allocates enough horizontal space to display all the browse columns. Otherwise, you can use a horizontal scrollbar to let the user scroll left and right through the columns.Note: You must specify either a- {
SIZE|SIZE-PIXELS}widthBYheight— As an alternative, you can define the size of the browse in both dimensions. This is the outer size of the browse including its border. When you use this option, Progress determines how many rows can be displayed at once, based on theheight. This might result in a partial row being displayed at the bottom of the browse.DOWNphrase or aSIZEphrase in the browse options.MULTIPLE|SINGLE— You can let the user select only a single row at a time or multiple rows. The default isSINGLE.SEPARATORS|NO-SEPARATORS— Separators are vertical and horizontal lines between columns and rows. The default isNO-SEPARATORS, but you will probably find that your browses look better withSEPARATORS.NO-ROW-MARKERS— By default, an updateable browse displays row markers, which let the user select currently displayed rows in an updateable browse widget without selecting any particular cell to update. This option prevents row markers from being displayed.NO-LABELS— This option suppresses the display of column labels for the columns.TITLEstring— You can optionally display a title bar across the top of the browse.NO-ASSIGN— If this option is not specified, data entered into an updateable browse is assigned on any action that results in aROW-LEAVEevent. TheNO-ASSIGNoption is intended for use with user-defined triggers on theROW-LEAVEevent. Essentially, when you specify this option, all data assignments by way of the updateable browse are up to you, the 4GL programmer. If you are defining a browse on a temp-table, then it is likely that the default support for automatic assigns back to the temp-table is appropriate because there are no transaction semantics to worry about. If you were to define an updateable browse directly against a database table, it is unlikely that the default assignment would be appropriate in any but the most trivial situations, so you would specifyNO-ASSIGNto take control of the update process yourself.NO-SCROLLBAR-VERTICAL|SCROLLBAR-VERTICAL— By default, a browse gets a vertical scrollbar, and this scrollbar is enabled whenever the size of the browse is not sufficient to display all the rows in the result set. You can suppress this default with theNO-SCROLLBAR-VERTICALkeyword. If you don’t have a vertical scrollbar, then the user must use the up and down arrow keys or other keys to navigate the browse. A browse always gets a horizontal scrollbar if the width of the browse is not sufficient to display all the columns.ROW-HEIGHT-CHARS|ROW-HEIGHT-PIXELS— (GUI only) By default, Progress assigns a row height appropriate for the font size used in the browse. You can change this default by specifying the row height in either characters or pixels.FIT-LAST-COLUMN— (GUI only) This option allows the browse to display so that there is no empty space to the right and no horizontal scroll bar, by widening or shrinking the last browse column’s width. When this attribute is specified, and the last browse column can be fully or partially displayed in the browse’s viewport, then the last browse column’s width is adjusted so that it fits within the viewport with no empty space to its right and no horizontal scroll bar. If the last browse column is fully contained in the viewport with empty space to its right, it grows so that its right edge is adjacent to the vertical scroll bar. If the last browse column extends outside the viewport, it shrinks so its right edge is adjacent to the vertical scroll bar and the horizontal scroll bar is not needed.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |